Allow field options in ifield, ofield
authorRobert Lipe <robertlipe@gpsbabel.org>
Sun, 22 Jul 2018 06:41:05 +0000 (01:41 -0500)
committerRobert Lipe <robertlipe@gpsbabel.org>
Sun, 22 Jul 2018 06:41:05 +0000 (01:41 -0500)
Options can make fields.size() of 4, so loosen error test for those.
Misc warning fixes.

xcsv.cc

diff --git a/xcsv.cc b/xcsv.cc
index 8fbcc69e30d63ac65e1748f5a3cc7b47fcade187..75c1b44d26ee76bfa41fb0ef526bee021b9eb2d8 100644 (file)
--- a/xcsv.cc
+++ b/xcsv.cc
@@ -211,8 +211,7 @@ xcsv_get_char_from_constant_table(const char* key)
 static void
 xcsv_parse_style_line(char* sbuff)
 {
-  int i, linecount = 0;
-  char* s, *sp;
+  char* sp;
   char* p;
   const char* cp;
   const char* key, *val, *pfc;
@@ -381,8 +380,8 @@ xcsv_parse_style_line(char* sbuff)
 
                                   QStringList fields = QString(&sbuff[6]).split(",", QString::KeepEmptyParts);
                                   // Note: simplifieid() has to run after split().
-                                  if (fields.size() != 3) {
-                                    Fatal() << "Invalied IFIELD line: " << sbuff;
+                                  if (fields.size() < 3) {
+                                    Fatal() << "Invalid IFIELD line: " << sbuff;
                                   }
 
                                   // The key ("LAT_DIR") should never contain quotes.
@@ -420,8 +419,8 @@ xcsv_parse_style_line(char* sbuff)
 
                                   QStringList fields = QString(&sbuff[6]).split(",", QString::KeepEmptyParts);
                                   // Note: simplifieid() has to run after split().
-                                  if (fields.size() != 3) {
-                                    Fatal() << "Invalied IFIELD line: " << sbuff;
+                                  if (fields.size() < 3) {
+                                    Fatal() << "Invalid OFIELD line: " << sbuff;
                                   }
 
                                   // The key ("LAT_DIR") should never contain quotes.